package com.recSys.dataTraining;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import com.recSys.util.ResourcePathHandler;

/**
 * Created by dell on 2018/1/29.
 */
public class Train4RecCeme {

    static final String rootPath = ResourcePathHandler.getProgrameRootPath();
    static final String toolPath = rootPath + "\\tools\\train.exe";
    static final String filePath4Ceme_train = rootPath + "\\data\\format\\recCeme_format.txt";
    static final String filePath4Ceme_model = rootPath + "\\data\\model\\recCeme_model.txt";

    //L2R_L2LOSS_SVC
    public static void trainL2L2 () {
        try {
            Runtime rt = Runtime.getRuntime();
            Process pr = rt.exec(toolPath + " -s 2 " + filePath4Ceme_train + " " + filePath4Ceme_model);
            BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream(), "GBK"));
            String line = null;
            while ((line = input.readLine()) != null) {
                System.out.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        trainL2L2();
    }
}
